package com.zl.tby.vo.exp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.zl.tby.model.TbyMountainsPerson;
import com.zl.tby.vo.TbyMountainsPersonForm;
import lombok.Data;
import org.noear.wood.utils.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 护林员
 * @author changpeng
 * @version 1.0
 * @since 2024/8/6 20:12
 */
@HeadRowHeight(20)
@ContentRowHeight(15)
@Data
public class TbyMountainsPersonExportExcel {
    @ExcelProperty(value = "姓名", index = 0)
    @ColumnWidth(15)
    private String name;
    @ExcelProperty(value = "电话", index = 1)
    @ColumnWidth(15)
    private String phone;
    @ExcelProperty(value = "是否审核", index = 2)
    @ColumnWidth(15)
    private String isAuditText;
    @ExcelProperty(value = "护林员类型", index = 3)
    @ColumnWidth(15)
    private String userTypeText;
    @ExcelProperty(value = "聘用状态", index = 4)
    @ColumnWidth(15)
    private String statusText;
    @ExcelProperty(value = "所属部门", index = 5)
    @ColumnWidth(15)
    private String orgName;
    @ExcelProperty(value = "职务", index = 6)
    @ColumnWidth(15)
    private String position;

    public TbyMountainsPersonExportExcel(TbyMountainsPersonForm form, Map<String, String> userTypeEnum, Map<String, String> statusEnum) {
        this.name = form.getName();
        this.phone = form.getPhone();
        this.orgName = form.getOrgName();
        this.position = form.getPosition();
        if (StringUtils.isNotEmpty(form.getIsAudit())) {
            form.setIsAuditText(form.getIsAudit().equals("1") ? "是" : "否");
        }
        if (StringUtils.isNotEmpty(form.getUserType())) {
            form.setUserType(userTypeEnum.get(form.getUserType()));
        }
        if (StringUtils.isNotEmpty(form.getStatus())) {
            form.setStatus(statusEnum.get(form.getStatus()));
        }
    }
}
